//
//  PresentationCell.m
//  ipadclient
//
//  Created by Stéphane Prohaszka on 07/05/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "PresentationCell.h"

#import <QuartzCore/QuartzCore.h>
#import "UIColor+RGB.h"

@implementation PresentationCell

@synthesize photo;
@synthesize title;
@synthesize author;
@synthesize description;
@synthesize votes;
@synthesize views;
@synthesize downloads;
@synthesize comments;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)drawRect:(CGRect)rect {
    [super drawRect:rect];
    
    UIView* firstSubView = [self.subviews objectAtIndex:0];
    firstSubView = [firstSubView.subviews objectAtIndex:0];
    CAGradientLayer* gradient = [CAGradientLayer layer];
    gradient.frame = firstSubView.bounds;
    gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorIntWithRed:73 green:73 blue:73] CGColor],
                       (id)[[UIColor colorIntWithRed:35 green:35 blue:35] CGColor], nil];
    [firstSubView.layer insertSublayer:gradient atIndex:0];
    
    UIView* blueView = [firstSubView viewWithTag:1];
    CAGradientLayer* blueGradient = [CAGradientLayer layer];
    blueGradient.frame = blueView.bounds;
    blueGradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorIntWithRed:77 green:142 blue:220] CGColor],
                           (id)[[UIColor colorIntWithRed:27 green:88 blue:181] CGColor], nil];
    [blueView.layer insertSublayer:blueGradient atIndex:0];
}

- (void)dealloc
{
    [super dealloc];
}

@end
